package parser;

import args.Args;
import args.PortArgs;

/**
 * @author leo
 * @date 2021/6/21
 */
public class PortParser{
    private static final String PORT_FLAG = "-p";
    private static final String DEFAULT_VALUE = "0";

    public Args parse(String args) {
        if (args.contains(PORT_FLAG)){
            String port = args.split(" ")[2];
            return new PortArgs(PORT_FLAG,port);
        }
        return new PortArgs(PORT_FLAG,DEFAULT_VALUE);
    }
}
